package com.mallcloud.mall.mall.api.entity.dto;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;

import java.util.Optional;

@ApiModel(value = "ProPointsProductRedeem", description = "积分兑换商品过程对象")
@Data
@ToString
public class ProPointsProductRedeem {

    @ApiModelProperty("积分兑换编码")
    private String id;
    @ApiModelProperty("兑换金额(单个)")
    private String redeemMoney;
    @ApiModelProperty("兑换积分(单个)")
    private String points;
    @ApiModelProperty("兑换数量")
    private String amount;
    @ApiModelProperty("手机号")
    private String mobile;
    @ApiModelProperty("会员卡号")
    private String cardNo;
    @ApiModelProperty("门店号")
    private String storeNo;

    @ApiModelProperty(value = "返回执行编码", hidden = true)
	private Integer messageId;
    @ApiModelProperty(value = "返回提示信息", hidden = true)
	private String message;
    @ApiModelProperty(value = "兑换单据编号", hidden = true)
	private String newId;
    @ApiModelProperty(value = "剩余库存", hidden = true)
	private String surplusStock;

	public boolean isSuccess() {
		return Optional.ofNullable(this.messageId).map(x -> x.equals(0)).orElse(false);
	}
}
